package spring.security.core.validatecode;

import java.io.Serializable;
import java.time.LocalDateTime;

public class ValidateCodeCode implements Serializable {
	
	private static final long serialVersionUID = -2141484149256624489L;

	private String code;

	private LocalDateTime expireTime;

	public ValidateCodeCode(String code, int expireIn) {
		this.code = code;
		this.expireTime = LocalDateTime.now().plusSeconds(expireIn);
	}
	
	public ValidateCodeCode(String code, LocalDateTime expireTime) {
		this.code = code;
		this.expireTime = expireTime;
	}
	
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public LocalDateTime getExpireTime() {
		return expireTime;
	}

	public void setExpireTime(LocalDateTime expireTime) {
		this.expireTime = expireTime;
	}

	public boolean isExpried() {
		return LocalDateTime.now().isAfter(getExpireTime());
	}
}
